//
//  DDLeftView.m
//  ialone
//
//  Created by lanou on 16/1/11.
//  Copyright © 2016年 JasperSong. All rights reserved.
//

#import "DDLeftView.h"
#import "UIView+Point.h"
#import "PKLine.h"
@implementation DDLeftView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self addSubview];
        self.backgroundColor = [UIColor colorWithRed:50/255.0 green:50/255.0 blue:48/255.0 alpha:1];
    }
    return self;
}

- (void)addSubview
{
    //返回按钮
    self.backButton = [UIButton buttonWithType:(UIButtonTypeCustom)];
    //self.backButton.backgroundColor = [UIColor redColor];
    [self.backButton setImage:[UIImage imageNamed:@"back"] forState:(UIControlStateNormal)];
    [self.backButton setImage:[UIImage imageNamed:@"back"] forState:(UIControlStateHighlighted)];
    self.backButton.frame = CGRectMake(10, 40, 35, 35);
    _backButton.transform = CGAffineTransformScale(_backButton.transform, 0.1, 0.1);
    _backButton.hidden = YES;
    [self addSubview:self.backButton];
    
    //设置按钮
    self.settingsButton = [UIButton buttonWithType:(UIButtonTypeCustom)];
    //self.settingsButton.backgroundColor = [UIColor redColor];
    [self.settingsButton setImage:[UIImage imageNamed:@"Settings"] forState:(UIControlStateNormal)];
     [self.settingsButton setImage:[UIImage imageNamed:@"Settings"] forState:(UIControlStateHighlighted)];
    self.settingsButton.frame = CGRectMake(kScreenWidth - 45, 40, 35, 35);
    _settingsButton.transform = CGAffineTransformScale(_settingsButton.transform, 0.1, 0.1);
    _settingsButton.hidden = YES;
    [self addSubview:self.settingsButton];
    
    //标题
    self.titleImage = [[UIImageView alloc]initWithFrame:CGRectMake((kScreenWidth - 75)/2, self.settingsButton.bottom+10, 75, 35)];
    self.titleImage.image = [UIImage imageNamed:@"title"];
    [self addSubview:self.titleImage];
    
    
   //线
    PKLine *line = [[PKLine alloc]initWithFrame:CGRectMake(0, self.titleImage.bottom + 20, kScreenWidth, 1)];
    [self addSubview:line];
    
    //线上的lable
    self.lable = [[UILabel alloc]initWithFrame:CGRectMake((kScreenWidth - 140)/2, line.frame.origin.y - 7, 140, 15)];
    self.lable.text = @"We  Read  The  World";
    self.lable.textAlignment = NSTextAlignmentCenter;
    self.lable.font = [UIFont systemFontOfSize:12];
    self.lable.textColor = [UIColor whiteColor];
    self.lable.backgroundColor = [UIColor colorWithRed:50/255.0 green:50/255.0 blue:48/255.0 alpha:1];
    [self addSubview:self.lable];
    
    //首页按钮
    self.pageButton = [UIButton buttonWithType:(UIButtonTypeCustom)];
    [self.pageButton setTitle:@"首    页" forState:(UIControlStateNormal)];
    [self.pageButton setTitleColor:[UIColor whiteColor] forState:(UIControlStateNormal)];
    self.pageButton.titleLabel.font = [UIFont systemFontOfSize:32];
    self.pageButton.backgroundColor = [UIColor colorWithRed:50/255.0 green:50/255.0 blue:48/255.0 alpha:1];
    NSLog(@"start: %lf",self.lable.bottom + 40);
    self.pageButton.frame = CGRectMake(0, self.lable.bottom + 40, 135, 45);
    [self addSubview:self.pageButton];
    
    
    //文字按钮
    self.textButton = [UIButton buttonWithType:(UIButtonTypeCustom)];
    [self.textButton setTitle:@"文    字" forState:(UIControlStateNormal)];
    [self.textButton setTitleColor:[UIColor whiteColor] forState:(UIControlStateNormal)];
    self.textButton.titleLabel.font = [UIFont systemFontOfSize:32];
    self.textButton.backgroundColor = [UIColor colorWithRed:50/255.0 green:50/255.0 blue:48/255.0 alpha:1];

    self.textButton.frame = CGRectMake(0, self.pageButton.bottom + 10, 135, 45);
    [self addSubview:self.textButton];
    
    //声音按钮
    self.voiceButton = [UIButton buttonWithType:(UIButtonTypeCustom)];
    [self.voiceButton setTitle:@"声    音" forState:(UIControlStateNormal)];
    [self.voiceButton setTitleColor:[UIColor whiteColor] forState:(UIControlStateNormal)];
    self.voiceButton.titleLabel.font = [UIFont systemFontOfSize:32];
    self.voiceButton.backgroundColor = [UIColor colorWithRed:50/255.0 green:50/255.0 blue:48/255.0 alpha:1];
    self.voiceButton.frame = CGRectMake(0, self.textButton.bottom + 10, 135, 45);
    [self addSubview:self.voiceButton];
    
    
    //影像按钮
    self.videoButton = [UIButton buttonWithType:(UIButtonTypeCustom)];
    [self.videoButton setTitle:@"影    像" forState:(UIControlStateNormal)];
    [self.videoButton setTitleColor:[UIColor whiteColor] forState:(UIControlStateNormal)];
    self.videoButton.titleLabel.font = [UIFont systemFontOfSize:32];
    self.videoButton.backgroundColor = [UIColor colorWithRed:50/255.0 green:50/255.0 blue:48/255.0 alpha:1];
    self.videoButton.frame = CGRectMake(0, self.voiceButton.bottom + 10, 135, 45);
    [self addSubview:self.videoButton];
    
    
    //单向历
    self.calendarButton = [UIButton buttonWithType:(UIButtonTypeCustom)];
    [self.calendarButton setTitle:@"单向历" forState:(UIControlStateNormal)];
    [self.calendarButton setTitleColor:[UIColor whiteColor] forState:(UIControlStateNormal)];
    self.calendarButton.titleLabel.font = [UIFont systemFontOfSize:32];
    self.calendarButton.backgroundColor = [UIColor colorWithRed:50/255.0 green:50/255.0 blue:48/255.0 alpha:1];
    self.calendarButton.frame = CGRectMake(0, self.videoButton.bottom + 10, 135, 45);
    [self addSubview:self.calendarButton];
    
    //搜索
    self.searchButton = [UIButton buttonWithType:(UIButtonTypeCustom)];
    [self.searchButton setTitle:@"搜    索" forState:(UIControlStateNormal)];
    [self.searchButton setTitleColor:[UIColor whiteColor] forState:(UIControlStateNormal)];
    self.searchButton.titleLabel.font = [UIFont systemFontOfSize:32];
    self.searchButton.backgroundColor = [UIColor colorWithRed:50/255.0 green:50/255.0 blue:48/255.0 alpha:1];
    self.searchButton.frame = CGRectMake((kScreenWidth - 135) / 2, self.calendarButton.bottom + 10, 135, 45);
    [self addSubview:self.searchButton];
    
    
    //最后底部lable
    self.lable1 = [[UILabel alloc]initWithFrame:CGRectMake((kScreenWidth - 110)/2, self.searchButton.bottom + 80, 110, 10)];
    self.lable1.text = @"Powered by OWSPACE";
    self.lable1.textAlignment = NSTextAlignmentCenter;
    self.lable1.font = [UIFont systemFontOfSize:10];
    self.lable1.textColor = [UIColor whiteColor];
    self.lable1.backgroundColor = [UIColor colorWithRed:50/255.0 green:50/255.0 blue:48/255.0 alpha:1];
     _lable1.transform = CGAffineTransformScale(_lable1.transform, 0.1, 1);
    [self addSubview:self.lable1];
    
    // 控件编号
    _pageButton.tag = 2700;
    _textButton.tag = 2701;
    _voiceButton.tag = 2702;
    _videoButton.tag = 2703;
    _searchButton.tag = 2704;
    _calendarButton.tag = 2705;
    
    _backButton.tag = 3400;
    _settingsButton.tag = 3401;
    
    _lable.tag = 3300;
    _lable1.tag = 3301;
    
    
    //(kScreenWidth - 135) / 2
}










/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
